package swg.shape;

import swg.utils.Utils;

public class Text implements IswgShape
{
	protected int x;
	protected int y;
	protected String txt;
	protected String style;
	protected String transform;
	

	public Text(int x, int y, String txt)
	{
		this.x = x;
		this.y = y;
		this.txt = txt;
	}

	public Text(int x, int y, String txt, String style)
	{
		this.x = x;
		this.y = y;
		this.txt = txt;
		this.style=style;
	}
	
	public Text (int x, int y, String txt, String style, String transform)
	{
		this.x = x;
		this.y = y;
		this.txt = txt;
		this.style=style;
		this.transform=transform;
	}

	public String getTxt()
	{
		return txt;
	}

	public void setTxt(String txt)
	{
		this.txt = txt;
	}

	public void setX(int x)
	{
		this.x = x;
	}

	public void setY(int y)
	{
		this.y = y;
	}

	@Override
	public int getR()
	{
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String getSWGCode()
	{
		//<text x="0" y="15" fill="red">I love SVG</text>
		String svgStyle="";
		String svgTransform="";
		if (style.length()>0);
		svgStyle=Utils.concat(" style=\"",style,"\" ");	
		
		if (transform.length()>0);
		svgTransform=Utils.concat(" transform=\"",transform,"\" ");	
		
		return Utils.concat("<text "," x=\"",x,"\""," y=\"",y,"\"",svgStyle,svgTransform," >",txt,"</text>\n");
	}

	@Override
	public int getX()
	{
		return x;
	}

	@Override
	public int getY()
	{
		return y;
	}

}
